package yf.mall.service.impl;

import com.yf.service.impl.BaseServiceImpl;
import yf.mall.dao.UserDao;
import yf.mall.entity.UserEntity;
import yf.mall.enums.AccountRecordBusEnum;
import yf.mall.enums.AccountRecordStatusEnum;
import yf.mall.enums.AccountRecordTypeEnum;
import yf.mall.enums.AccountTypeEnum;
import yf.mall.service.NoticeService;
import yf.mall.vo.AccountRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import yf.mall.dao.AccountRecordDao;
import yf.mall.entity.AccountRecordEntity;
import yf.mall.service.AccountRecordService;

import java.math.BigDecimal;
import java.util.List;

/**
 * 账户记录Service实现类
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Mon Aug 26 16:58:11 CST 2019
 */
@Service
public class AccountRecordServiceImpl extends BaseServiceImpl<AccountRecordEntity> implements AccountRecordService {

    private AccountRecordDao accountRecordDao;


    @Autowired
    public void setDao(AccountRecordDao accountRecordDao) {
        this.accountRecordDao = accountRecordDao;
        super.setBaseDao(accountRecordDao);
    }


    /**内部方法**/


    /**
     * 外部方法实现
     **/


    @Override
    public List<AccountRecordVo> queryListVo(AccountRecordVo params) {
        return accountRecordDao.queryListVo(params);
    }

    @Override
    public AccountRecordVo getVo(Long id) {
        return accountRecordDao.getVo(id);
    }

    @Override
    public List<AccountRecordVo> findByUserId(Long userId, Integer type, Integer status, Integer bus) {
        return accountRecordDao.findByUserId(userId, type, status, bus);
    }

    /**
     * que
     * 待收款
     *
     * @param userId
     * @return
     */
    @Override
    public BigDecimal waitIncome(Long userId) {
        return accountRecordDao.waitIncome(userId, AccountRecordStatusEnum.WAIT.getIndex(), AccountRecordTypeEnum.CASH.getIndex(),
                AccountRecordBusEnum.PAYMENT.getIndex(), AccountRecordBusEnum.SHARE_REWARD.getIndex());
    }



}
